import Taro, { Component, useState } from '@tarojs/taro';
import { View, Image } from '@tarojs/components';
import Kind from '../../static/card/icon_kind.png';
import NumberIcon from '../../static/card/icon_number.png';
import Time from '../../static/card/icon_time.png';
import Agengcy from '../../static/card/icon_people.png';
import Close from '../../static/card/icon_delete.png';

import classnames from 'classnames';

import './index.scss';

/**
 * @param {number} type 0 是我的兑换卡记录 1 是申领卡 2申领记录(申请卡和激活卡的区别是第二行一个是数量一个卡号) 3 我的兑换卡 4 出库卡的信息 5 入库记录 6 出库记录
 * @param {viplist} type 0 是我的兑换卡记录 1 是申领卡 2申领记录(申请卡和激活卡的区别是第二行一个是数量一个卡号) 3 我的兑换卡 4 出库卡的信息 5 入库记录 6 出库记录

 */
function Card({ viplist, sku, status, number, type = 0, cardType, agency, cardId }) {
  const uerInfo = Taro.getStorageSync('userInfo');

  function deleteOutput() {
    this.props['onDel'](number)
  }

  function sureArrive() {
    this.props['arrive'](cardId)
  }

  return (
    <View className={classnames({
      "card": true,
      "not-my": type,
    })}>
      {/* {
        type === 4 ? <Image className="close" onClick={deleteOutput} src={Close} alt="close" /> : (status === 'showArrive' ? <View className="sure-arrive" onClick={sureArrive}>确认到货</View> : <View className="status">{status}</View>)
      } */}

      <View className="card-line">
        <Image src={Time} alt="" className="icon" />
        <View>会员类型：{viplist.member_type}</View>
      </View>
      <View className="card-line">
        <Image src={Time} alt="" className="icon" />
        <View>会员用户名：{viplist.has_exchange_user.nickname}</View>
      </View>
      <View className="card-line">
        <Image src={Time} alt="" className="icon" />
        <View>会员卡消费金额：{viplist.money}</View>
      </View>
      <View className="card-line">
        <Image src={Time} alt="" className="icon" />
        <View>卡号：{viplist.card_no}</View>
      </View>
      <View className="card-line">
        <Image src={Time} alt="" className="icon" />
        <View>昵称：{viplist.card_no}</View>
      </View>

      {/* {
 
      }
      <View className="card-line" >
        <Image src={Kind} alt="" className="icon" />
        {(!type) && <View>兑换规格：{sku}</View>}
        {(type) && <View>类型：{cardType}</View>}
      </View>
      {
        (type === 6) && <View className="card-line" >
          <Image src={Agengcy} alt="" className="icon" />
          <View>代理：{agency}</View>
        </View>
      } */}
    </View>
  )
}

export default Card;
